<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // ajax技术
    // XMLHttpRequest 
    function ajax(opts){
      let xhr = new XMLHttpRequest();
      xhr.open('get', '/checkUserName', true);
      xhr.onload = function(){
        if(xhr.readyState === 4) {
          if(xhr.status === 200){
            document.write(xhr.responseText);
          }
        }
      }
      xhr.send();
    }

    ajax();
  </script>
</body>
</html>